/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.S200;
import queenb.net.entitybean.V200;
import queenb.web.inteface.S200Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class S200Store extends S200 implements S200Inf {

    @Override
    public List<S200> getListS200All(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_S200, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
        
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, S200.class);
        } catch (SQLException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateV200(int pnPS200,
            int pnFH000,
            int pnFH200,
            int pnFH300,
            int pnFV200,
            int pnFC000,
            String pvFC550,
            int pnFC425,
            String pvSV201,
            String pvSV202,
            String pvSV203,
            String pvSV204,
            String pvSV205,
            String pvSV206,
            String pvSV207,
            String pvSV208,
            String pvSV209,
            String pvSV210,
            String pvSV211,
            String pvSV212,
            String pvSV213,
            String pvSV214,
            int pnSN215,
            int pnSN216,
            String pvSV217,
            String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_S200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPS200),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFH300),
                    new Param(OracleTypes.INTEGER, pnFV200),
                    new Param(OracleTypes.INTEGER, pnFC000),
                    new Param(OracleTypes.CHAR, pvFC550),
                    new Param(OracleTypes.INTEGER, pnFC425),
                    new Param(OracleTypes.CHAR, pvSV201),
                    new Param(OracleTypes.CHAR, pvSV202),
                    new Param(OracleTypes.CHAR, pvSV203),
                    new Param(OracleTypes.CHAR, pvSV204),
                    new Param(OracleTypes.CHAR, pvSV205),
                    new Param(OracleTypes.CHAR, pvSV206),
                    new Param(OracleTypes.CHAR, pvSV207),
                    new Param(OracleTypes.CHAR, pvSV208),
                    new Param(OracleTypes.CHAR, pvSV209),
                    new Param(OracleTypes.CHAR, pvSV210),
                    new Param(OracleTypes.CHAR, pvSV211),
                    new Param(OracleTypes.CHAR, pvSV212),
                    new Param(OracleTypes.CHAR, pvSV213),
                    new Param(OracleTypes.CHAR, pvSV214),
                    new Param(OracleTypes.INTEGER, pnSN215),
                    new Param(OracleTypes.INTEGER, pnSN216),
                    new Param(OracleTypes.CHAR, pvSV217),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, S200.class);
        } catch (SQLException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteV200(int pnPS200, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_S200, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPS200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, S200.class);
        } catch (SQLException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<S200> getListS200Comb(int pnFH000, int pnFH200, String pvLOGIN) {
         try {
            DataStatement data = new DataStatement(PackageContants.LIST_S200COM, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, S200.class);
        } catch (SQLException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateS200(int pnFH000, int pnFH200, int pnPS200, String pvSV201, String pvSV202, String pvSV203, String pvSV204, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_S200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnPS200),
                    new Param(OracleTypes.CHAR, pvSV201),
                    new Param(OracleTypes.CHAR, pvSV202),
                    new Param(OracleTypes.CHAR, pvSV203),
                    new Param(OracleTypes.CHAR, pvSV204),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, S200.class);
        } catch (SQLException ex) {
            Logger.getLogger(S200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
}
